package com.zhiyou100.controller;

import cn.hutool.core.lang.Console;
import com.zhiyou100.entity.ResponseJson;
import com.zhiyou100.service.ITabDirectoryService;
import com.zhiyou100.service.ITabUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.annotation.Resources;
import javax.servlet.http.HttpServletRequest;

/**
 * 用户 controller
 *
 * @author yang
 * @version 1.0.0
 * @date 2020-10-09 19:37
 * RestController = Controller + ResponseBody
 */
@RestController
public class UserController {
    @Autowired
    private ITabUserService service;

    @PostMapping("/user/login.action")
    public ResponseJson<Object> loginMethod(@RequestParam("uname") String uname, @RequestParam("upwd") String upwd, HttpServletRequest request) {
        return service.login(uname, upwd, request);
    }

    @GetMapping("/user/logout/{uid}.action")
    public ResponseJson<Object> logoutMethod(@PathVariable("uid") Integer uid, HttpServletRequest request) {
        return service.logout(uid, request);
    }
}
